package com.tojabo.piano;

import java.io.InputStream;

import com.tojabo.sound.ogg.NewOggPlayer;
import com.tojabo.sound.ogg.SinglePlayerManager;
import com.tojabo.util.SystemUtil;

public class PianoPlayThread extends Thread {

	private String soundname;
	
	public PianoPlayThread(String filename){
		soundname = filename;
	}
	
	@Override
	public void run() {
		
		SinglePlayerManager manager=SinglePlayerManager.getIntance();
		NewOggPlayer player = manager.pollOggPlayer();
		InputStream instream = SystemUtil.getInputStream(soundname);
		player.play(instream);
		manager.rebackOggPlayer(player);
	}
	
}
